package com.cyou.demo.controller;

import com.cyou.demo.model.Person;
import com.cyou.demo.service.PersonService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.*;

/**	Created by chenzhuo_m on 2018/3/7. */

@RestController
@Api(value = "spring-boot服务" ,description = "用户API")
public class PersonController {

	@Autowired
	private PersonService personService ;

	@ApiOperation(value = "展示用户",notes = "id在路径中",httpMethod = "GET")
	@ResponseBody
	@RequestMapping("/showUser/{id}")
	public Person selectUser(@PathVariable Long id){
		Person person = personService.selectUser(id);
		return person ;
	}

	@ApiOperation(value = "用户信息", notes = "id作为参数" ,httpMethod = "GET")
	@ResponseBody
	@RequestMapping(value = "/userInfo")
	public Person getUserInfo(@RequestParam(value = "id", required = true) Long userId){
		Person person = personService.getUserInfo(userId);
		return person ;
	}


}
